package cn.dfun.demo.scdemo.ali.seata.controller;

import cn.dfun.demo.scdemo.ali.seata.service.AccountService;
import cn.dfun.demo.scdemo.common.entity.CommonResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

@RestController
public class AccountController {
    @Resource
    private AccountService accountService;

    @PostMapping("/account/decrease")
    public CommonResult decrease(@RequestParam Long userId, @RequestParam BigDecimal money) {
        accountService.decrease(userId, money);
        return CommonResult.success();
    }
}
